package com.tianji.promotion.service;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.promotion.domain.po.Coupon;
import com.tianji.promotion.domain.po.UserCoupon;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tianji.promotion.domain.query.UserCouponQuery;
import com.tianji.promotion.domain.vo.UserCouponPageVO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 用户领取优惠券的记录，是真正使用的优惠券信息 服务类
 * </p>
 *
 * @author niu
 */
public interface IUserCouponService extends IService<UserCoupon> {

    void receive(Long couponId);

    void exchangeCoupon(String code);


    PageDTO<UserCouponPageVO> userCouponPage(UserCouponQuery query);

    @Transactional(rollbackFor = Exception.class)
    void checkAndCreateUserCoupon(Long userId, Coupon coupon);

    List<Coupon> getAvailableByUserId(Long userId);
}
